"""重命名为hash_password字段

Revision ID: ee654d2a09d6
Revises: dd0648b0f354
Create Date: 2025-11-17 16:25:33.737171

"""

from typing import Sequence, Union

import sqlalchemy as sa
import sqlmodel
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "ee654d2a09d6"
down_revision: Union[str, Sequence[str], None] = "dd0648b0f354"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "users",
        sa.Column("hash_password", sqlmodel.sql.sqltypes.AutoString(length=100), nullable=False, comment="密码"),
    )
    op.drop_column("users", "password")
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "users", sa.Column("password", sa.VARCHAR(length=100), autoincrement=False, nullable=False, comment="密码")
    )
    op.drop_column("users", "hash_password")
    # ### end Alembic commands ###
